<!doctype html>



  


<html class="theme-next pisces use-motion">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />












  
  
  <link href="/vendors/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/vendors/font-awesome/css/font-awesome.min.css?v=4.4.0" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.0.1" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Hexo, NexT" />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.0.1" />






<meta name="description" content="ubuntu安装android-studio
安装JDK1、由于我一键安装android-studio时openJDK依赖关系发生错误，所以这里手动下载JDK，先选Accept License Agreement后可下载。我的Linux系统为ubuntukylin 16.04 64位的，所以选择64位的版本。
2、进入默认的下载目录下 home/下载/ 进行解压文件1$ tar -zxvf jdk">
<meta property="og:type" content="article">
<meta property="og:title" content="ubuntu安装android-studio">
<meta property="og:url" content="http://yoursite.com/2016/06/13/ubuntu_android-studio/index.html">
<meta property="og:site_name" content="RoyceLee's blog">
<meta property="og:description" content="ubuntu安装android-studio
安装JDK1、由于我一键安装android-studio时openJDK依赖关系发生错误，所以这里手动下载JDK，先选Accept License Agreement后可下载。我的Linux系统为ubuntukylin 16.04 64位的，所以选择64位的版本。
2、进入默认的下载目录下 home/下载/ 进行解压文件1$ tar -zxvf jdk">
<meta property="og:updated_time" content="2016-06-13T08:18:22.910Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="ubuntu安装android-studio">
<meta name="twitter:description" content="ubuntu安装android-studio
安装JDK1、由于我一键安装android-studio时openJDK依赖关系发生错误，所以这里手动下载JDK，先选Accept License Agreement后可下载。我的Linux系统为ubuntukylin 16.04 64位的，所以选择64位的版本。
2、进入默认的下载目录下 home/下载/ 进行解压文件1$ tar -zxvf jdk">



<script type="text/javascript" id="hexo.configuration">
  var NexT = window.NexT || {};
  var CONFIG = {
    scheme: 'Pisces',
    sidebar: {"position":"left","display":"post"},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: 0,
      author: '博主'
    }
  };
</script>




  <link rel="canonical" href="http://yoursite.com/2016/06/13/ubuntu_android-studio/"/>

  <title> ubuntu安装android-studio | RoyceLee's blog </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  










  
  
    
  

  <div class="container one-collumn sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-meta ">
  

  <div class="custom-logo-site-title">
    <a href="/"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">RoyceLee's blog</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
  <p class="site-subtitle">Rumours find no credence with a wise man</p>
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
    </ul>
  

  
</nav>

 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  
  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                ubuntu安装android-studio
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            <span class="post-meta-item-icon">
              <i class="fa fa-calendar-o"></i>
            </span>
            <span class="post-meta-item-text">发表于</span>
            <time itemprop="dateCreated" datetime="2016-06-13T16:18:22+08:00" content="2016-06-13">
              2016-06-13
            </time>
          </span>

          

          
            
          

          

          
          

          
        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="ubuntu安装android-studio"><a href="#ubuntu安装android-studio" class="headerlink" title="ubuntu安装android-studio"></a>ubuntu安装android-studio</h1><hr>
<h2 id="安装JDK"><a href="#安装JDK" class="headerlink" title="安装JDK"></a>安装JDK</h2><p>1、由于我一键安装android-studio时openJDK依赖关系发生错误，所以这里手动下载JDK，先选Accept License Agreement后可下载。我的Linux系统为ubuntukylin 16.04 64位的，所以选择64位的版本。</p>
<p>2、进入默认的下载目录下 home/下载/ 进行解压文件<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ tar -zxvf jdk-8u91-linux-x64.tar.gz &amp;&amp; sudo mv jdk1.8.0_91 /opt</span><br></pre></td></tr></table></figure></p>
<p>3、配置jdk环境变量<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ sudo vi /etc/profile</span><br></pre></td></tr></table></figure></p>
<p>   在文件最后加上以下内容，注意自己的jdk路径：<br>   export JAVA_HOME=/opt/jdk1.8.0_91<br>   export JRE_HOME=${JAVA_HOME}/jre<br>   export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:${JAVA_HOME}/lib/tools.jar<br>   export PATH=${JAVA_HOME}/bin:$PATH  </p>
<p>4、在该全件最后也添加3中内容<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ sudo vi /home/lc/.bashrc</span><br></pre></td></tr></table></figure></p>
<p>5、同步更新3、4中的两个文件：<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ <span class="built_in">source</span> /etc/profile &amp;&amp; <span class="built_in">source</span> /home/lc/.bashrc</span><br></pre></td></tr></table></figure></p>
<p>使用java -version测试下环境变量是否设置成功。</p>
<h2 id="安装android-studio和sdk"><a href="#安装android-studio和sdk" class="headerlink" title="安装android-studio和sdk"></a>安装android-studio和sdk</h2><p>1、在www.android-studio.org中下载android-studio和sdk。同2中一样分别解压两个文件，但需要注意由于sdk以后会越来越大，所以建议将sdk解压到/home/下。防止根目录空间不足。</p>
<p>2、<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ sudo vi /opt/android-studio/bin/idea.porperties</span><br></pre></td></tr></table></figure></p>
<p>在最后添加disable.android.first.run=true 否则会因s为网络问题一直卡在”Fetching Android SDK component information”</p>
<p>3、<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ sh /opt/android-studio-XXXX/bin/studio.sh</span><br></pre></td></tr></table></figure></p>
<p>在弹窗中分别配置jdk和sdk的路径，至此恭喜你安装完成。</p>
<p>4、安装完成后需要安装不同版本的sdk，启动sdk有两种方式：<br>    1）在${SDK_HOME}/tools/下执行./android，就可以单独启动sdk进行不同版本SDK的安装，若出现网络问题，www.android-studio.org上有代理教程可以设置代理进行下载。<br>    2）在android-studio中直接启动SDK。</p>
<p>5、设置adb环境变量，在/etc/profile最后面加上如下内容，同步更新这个文件即可：<br>    export PATH=$PATH:/home/lc/android-sdk-linux/tools/<br>    export PATH=$PATH:/home/lc/android-sdk-linux/platform-tools/</p>
<h2 id="问题汇总"><a href="#问题汇总" class="headerlink" title="问题汇总"></a>问题汇总</h2><p>1、由于64位ubuntu在编译打包APK时缺少X86下的C++语言库，所以需要安装库先：<br>    sudo apt-get install lib32stdc++6 lib32z1，否则会报如下错误：<br>    java.io.IOException: Cannot run program “/home/lc/workspace/android-sdk-linux/build-tools/23.0.2/aapt”: error=2, 没有那个文件或目录</p>
<p>2、如果monitor中报错提示：pls config SDK，同时project structure中提示：ndk does not contain any platforms，则需要对ndk进行更新，否则gradle同步时会报系统内部错误。</p>
<p>3、如果存在android升级不生效，升级包下载后不重启的问题，则需要在/etc/profile中将${ANDOIR_STUDIO_HOME}/bin添加到环境变量中，因为找不到studio.sh，所以下载完升级包后无法自动重启升级。</p>
<p>到这里ubuntu上的android开发环境基本已经大功告成，可以尽情的玩耍了。</p>

      
    </div>

    <div>
      
        
      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
          </div>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2016/06/14/ubuntu_hexo_blog/" rel="prev" title="ubuntu下用hexo搭建静态博客">
                ubuntu下用hexo搭建静态博客 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel ">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/avatar.gif"
               alt="RoyceLee" />
          <p class="site-author-name" itemprop="name">RoyceLee</p>
          <p class="site-description motion-element" itemprop="description">Rumours find no credence with a wise man</p>
        </div>
        <nav class="site-state motion-element">
          <div class="site-state-item site-state-posts">
            <a href="/archives">
              <span class="site-state-item-count">2</span>
              <span class="site-state-item-name">日志</span>
            </a>
          </div>

          

          

        </nav>

        

        <div class="links-of-author motion-element">
          
        </div>

        
        

        
        

      </section>

      
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">
            
              
            
            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#ubuntu安装android-studio"><span class="nav-number">1.</span> <span class="nav-text">ubuntu安装android-studio</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#安装JDK"><span class="nav-number">1.1.</span> <span class="nav-text">安装JDK</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#安装android-studio和sdk"><span class="nav-number">1.2.</span> <span class="nav-text">安装android-studio和sdk</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#问题汇总"><span class="nav-number">1.3.</span> <span class="nav-text">问题汇总</span></a></li></ol></li></ol></div>
            
          </div>
        </section>
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2016</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">RoyceLee</span>
</div>

<div class="powered-by">
  由 <a class="theme-link" href="http://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Pisces
  </a>
</div>

        

        
      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  



  
  <script type="text/javascript" src="/vendors/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/vendors/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/vendors/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/vendors/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/vendors/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/vendors/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.0.1"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.0.1"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.0.1"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.0.1"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.0.1"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.0.1"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.0.1"></script>



  



  




  
  
  

  

  

</body>
</html>
